<?php
$version = Zend_Registry::get('version');	
echo $this->headScript()->setFile($this->baseUrl().'/js/jquery/table-sorter/jquery.dataTables.js');

$mem_db = new Members_Model_DbTable_MemberList();
$global_conf = Zend_Registry::get('global_conf');
$currency = new Zend_Currency($global_conf['default_locale']);
$currencySymbol = $currency->getSymbol();
$currencyShort = $currency->getShortName();

$gateway_db = new Paymentgateway_Model_DbTable_Gateway();
$gateway_info	=	$gateway_db->getAllActiveGateway('ASC');
?>
<script type="text/javascript">

$(document).ready(function() {
	
	floatingbar('#floatingbar',"#button_top_bar",null);		
		
	/****************************Sorting Table Start*********************/
	var oTable = $("#sortTable").dataTable({
				"bPaginate": false,
				"bDestroy":true,
				"bLengthChange": true,
				"bSearchable": true,
				"bFilter": true,
				"bSort": true,
				"bInfo": false,
				"bAutoWidth": true,
				"bProcessing": false,
				"bSortClasses": true,
				"bStateSave": false,
				"bServerSide": false,
				"aaSorting": [[ 3, "desc" ]],				
				"aoColumnDefs": [ 
						{ "bSortable": false, "bSortClasses": false,  "aTargets": [ 0 ] }
					],
				"oLanguage" : { "sSearch": "<?php echo $this->translator->translator('jquery_filter'); ?>" }
			}); 	
	
	$('td', oTable.fnGetNodes()).hover( function() {		
		$(this).parents("tr:first").children('td').addClass( 'highlighted' );
	}, function() {
		$('td.highlighted').removeClass('highlighted');
	});	
	
	/****************************Sorting Table End*********************/
	
	$('select.full_payment').change(function() {
		var self = this;
		if($(self).val() != null && $(self).val() != '')
		{
			var data = 	$(self).val();
			var data_arr = 		data.split('_');	
			$.ajax({
					url: "<?php echo $this->url( array('module'=> 'Invoice', 'controller' => 'backend', 'action'     => 'fullpay' ), 'adminrout',    true) ?>",
					type: 'POST',
					data: { payment_id: data_arr[0], invoice_id: data_arr[1]},
					beforeSend: function(){
						$(self).parents('td:first').children('span:first').html('<img src="application/modules/Administrator/layouts/scripts/images/loader/ajax_loader.gif" height="16" border="0" />');
					 },
					success: function(response) 
					{
						//alert(response);
						var json_arr = eval("("+response+")");
						if(json_arr.status == 'ok')
						{
							var payment_link	=	json_arr.payment_data;
							var payment_logo	=	json_arr.payment_info.logo;
							var input_type		=	json_arr.input_type;
							//alert(payment_logo);
							var	html_data	=	(input_type == 'link') ? '<a href="'+payment_link+'" target="_blank"><img src="data/frontImages/gateway/gateway_logo/'+payment_logo+'" width="140" /></a>' : payment_link;
							$(self).parents('td:first').children('span:first').html(html_data);
							UPay_Pay();
						}
						else
						{
							openMsgDialog(json_arr.msg);
							$(self).parents('td:first').children('span:first').html('');
						}							
					},
					error: function(xhr, status, error){						
						$(self).parents('td:first').children('span:first').html('');
						var msg = "Error! " + xhr.status + " " + error;
						openMsgDialog(msg);
					}
			});			
		}
		else
		{
			$(self).parents('td:first').children('span:first').html('');
		}
		
	});
	
		function stripslashes(str) 
		{
			str=str.replace(/\\'/g,'\'');
			str=str.replace(/\\"/g,'"');
			str=str.replace(/\\0/g,'\0');
			str=str.replace(/\\\\/g,'\\');
			return str;
		}
		
			
		allFunction();		
			
		
		function deleteAll(self)
		{
			var id_str = '';
			for(var i=0;i < $('input.check_btn:checked').length;i++)
			{
				if(i == 0)
				{
					 id_str += $('input.check_btn:checked:eq('+i+')').val();
				}
				else
				{
					id_str += ','+$('input.check_btn:checked:eq('+i+')').val();
				}
			}
			
			$.ajax({
					url: "<?php echo $this->url( array('module'=> 'Invoice', 'controller' => 'backend', 'action'     => 'deleteall' ), 'adminrout',    true) ?>",
				 	type: 'POST',
				 	data: { id_st: id_str},
					beforeSend: function(){
						$(self).html('<span class="icon loader"></span>');
					 },
					success: function(response) 
				 	{
						//alert(response);
						var json_arr = eval("("+response+")");
						if(json_arr.status == 'ok')
						{
							for(var i= ($('input.check_btn:checked').length-1);i >= 0;i--)
							{								
								$('input.check_btn:checked:eq('+i+')').parents("td:first").parents("tr:first").addClass('row_selected');							
							}
							var oTabled = $('#sortTable').dataTable();
							var anSelected = fnGetSelected( oTabled );
							for(var k = 0; k < anSelected.length; k++)
							{
								oTabled.fnDeleteRow( anSelected[k] );
							}
						}
						else
						{							
							openMsgDialog(json_arr.msg);
						}	
						$(self).html('<span class="icon delete"><?php echo html_entity_decode($this->translator->translator("common_delete_selected"), ENT_QUOTES, "UTF-8"); ?></span>');
					},
					error: function(xhr, status, error){				
						var msg = "Error! " + xhr.status + " " + error;
						openMsgDialog(msg);
					}
			});	
		}
		
	$('a.invoice_btn').each(function()
	   {
		  // We make use of the .each() loop to gain access to each element via the "this" keyword...
		  $(this).qtip(
		  {
			 content: {
				// Set the text to an image HTML string with the correct src URL to the loading image you want to use
				text: '<div class="loader-big"><img src="application/modules/Administrator/layouts/scripts/images/loader/loader.gif" border="0" /></div>',
				ajax: {
				   url: "<?php echo $this->url( array('module'=> 'Invoice', 'controller' => 'backend', 'action'     => 'view' , 'invoice_id' => '' ), 'adminrout',    true) ?>"+$(this).attr('rel') // Use the rel attribute of each element for the url to load
				},
				title: {
				   text: "<?php echo $this->translator->translator('invoice_list_invoice_preview'); ?>", // Give the tooltip a title using each elements text
				   button: true
				}
			 },
			 position: {			 	
				at: 'center', // Position the tooltip above the link
				my: 'center',
				target: $(window),
				viewport: $(window) // Keep the tooltip on-screen at all times
			 },
			 show: {
				event: 'click',
				effect: function() { $(this).show(100); } ,
				modal: true,
				solo: true // Only show one tooltip at a time
			 },
			 hide: {
			 	event: 'unfocus',
				effect: function() { $(this).hide(100); }
			 },
			 style: {
				classes: 'ui-tooltip-wiki ui-tooltip-light ui-tooltip-shadow'
			 }
		  })
		  
		  // Make sure it doesn't follow the link when we click it
		  .click(function() { return false; });
	   });

		
		
	$('a.publish_all').click(function() {
		var self = this;
		var bigrel = $(self).attr('rel');
		if($('input.check_btn:checked').length > 0)
		{
			var id_str = '';
			for(var i=0;i < $('input.check_btn:checked').length;i++)
			{
				if(i == 0)
				{
					 id_str += $('input.check_btn:checked:eq('+i+')').val();
				}
				else
				{
					id_str += ','+$('input.check_btn:checked:eq('+i+')').val();
				}
			}
			
			$.ajax({
					url: "<?php echo $this->url( array('module'=> 'Invoice', 'controller' => 'backend', 'action'     => 'paid' ), 'adminrout',    true) ?>",
				 	type: 'POST',
				 	data: { id_st: id_str, paction: bigrel},
					beforeSend: function(){
						$(self).html('<span class="icon loader"></span>');
					 },
					success: function(response) 
				 	{
						//alert(response);
						var json_arr = eval("("+response+")");
						if(json_arr.status == 'ok')
						{
							switch(bigrel)
							{
								case 'paid':
									for(var i=0;i < $('input.check_btn:checked').length;i++)
									{								
										$('input.check_btn:checked:eq('+i+')').parents("td:first").parents("tr:first").children("td:nth-child(8)").html("<?php echo $this->translator->translator('common_paid_language'); ?>");																																
										$('input.check_btn:checked:eq('+i+')').parents("td:first").parents("tr:first").children("td:nth-child(6)").children("span:first").html("<?php echo $this->translator->translator("invoice_list_invoice_now_payable_paid_language"); ?>");
										$('input.check_btn:checked:eq('+i+')').parents("td:first").parents("tr:first").children("td:nth-child(6)").children("a:first").css('display', 'none');
									}									
									break;
								case 'unpaid':
									for(var i=0;i < $('input.check_btn:checked').length;i++)
									{								
										$('input.check_btn:checked:eq('+i+')').parents("td:first").parents("tr:first").children("td:nth-child(8)").html("<?php echo $this->translator->translator('common_unpaid_language'); ?>");							
										$('input.check_btn:checked:eq('+i+')').parents("td:first").parents("tr:first").children("td:nth-child(6)").children("span:first").html("<?php echo $this->translator->translator("invoice_list_invoice_now_payable_unpaid_language"); ?>");
									}
									break;	
								case 'cancel':
									for(var i=0;i < $('input.check_btn:checked').length;i++)
									{								
										$('input.check_btn:checked:eq('+i+')').parents("td:first").parents("tr:first").children("td:nth-child(8)").html("<?php echo $this->translator->translator('common_cancelled_language'); ?>");							
										$('input.check_btn:checked:eq('+i+')').parents("td:first").parents("tr:first").children("td:nth-child(6)").children("span:first").html("<?php echo $this->translator->translator("invoice_list_invoice_now_payable_unpaid_language"); ?>");
									}
									break;	
							}
						}
						else
						{
							openMsgDialog(json_arr.msg);
						}	
						switch(bigrel)
						{	
							case 'paid':
								$(self).html('<span class="icon publish"><?php echo $this->translator->translator("common_paid_selected"); ?></span>');
								break;
							case 'unpaid':
								$(self).html('<span class="icon unpublish"><?php echo $this->translator->translator("common_unpaid_selected"); ?></span>');
								break;
							case 'cancel':
								$(self).html('<span class="icon close"><?php echo $this->translator->translator("common_cancel_selected"); ?></span>');
								break;
						}
					},
					error: function(xhr, status, error){						
						var msg = "Error! " + xhr.status + " " + error;
						openMsgDialog(msg);
					}
			});			
		}
		else
		{
			var msg = "<?php echo $this->translator->translator('invoice_selected_err'); ?>";
			openMsgDialog(msg);
		}
	});
		
	$('a.delete_all').click(function() {
		var self = this;
		if($('input.check_btn:checked').length > 0)
		{
			$("#dialog-confirm").html("<?php echo addslashes($this->translator->translator('invoice_list_delete_confirm')); ?>").dialog({
					resizable: false,
					width:400,
					height:170,
					modal: true,
					show: 'fade',
					hide: 'explode',
					buttons: {
							'<?php echo html_entity_decode($this->translator->translator("common_delete_selected"), ENT_QUOTES, "UTF-8"); ?>': function() {
							deleteAll(self);
							$(this).dialog('close');
						},
					'<?php echo html_entity_decode($this->translator->translator("common_cancel"), ENT_QUOTES, "UTF-8"); ?>': function() {
							$(this).dialog('close');
						}
					}
				});		
		}
		else
		{
			var msg = "<?php echo $this->translator->translator('invoice_selected_err'); ?>";
			openMsgDialog(msg);
		}
	});
	
	$('input.checkAll_btn').click(function() {
		var self = this;
		if($(self).is(':checked'))
		{		
			$('input.check_btn').attr('checked', true);
		}
		else
		{
			$('input.check_btn').attr('checked', false);
		}
	});
	
			
});

function deleteThis(self)
{
	var arr = $(self).attr('rel').split('_');
	$.ajax({
		 url: "<?php echo $this->url( array('module'=> 'Invoice', 'controller' => 'price', 'action'     => 'delete' ), 'adminrout',    true) ?>",
		 type: 'POST',
		 data: { id: arr[0], group_id: arr[1]},
		 beforeSend: function(){
				$(self).html('<img src="application/modules/Administrator/layouts/scripts/images/loader/ajax_loader.gif" height="16" border="0" />');
			 },
		 success: function(response) 
		 {
			//alert(response);
			var json_arr = eval("("+response+")");
			if(json_arr.status == 'ok')
			{
				$(self).parents("li:first").parents("ul:first").parents("td:first").parents("tr:first").addClass('row_selected');
				var oTables = $('#sortTable').dataTable();
				var anSelected = fnGetSelected( oTables );
				oTables.fnDeleteRow( anSelected[0] );
			}
		 },
		error: function(xhr, status, error){				
			var msg = "Error! " + xhr.status + " " + error;
			openMsgDialog(msg);
		}
	});
}

/* Get the rows which are currently selected */
function fnGetSelected( oTableLocal )
{
	var aReturn = new Array();
	var aTrs = oTableLocal.fnGetNodes();
	
	for ( var i=0 ; i<aTrs.length ; i++ )
	{
		if ( $(aTrs[i]).hasClass('row_selected') )
		{
			aReturn.push( aTrs[i] );
		}
	}
	return aReturn;
}

function openMsgDialog(msg)
{
$('#dialog_container').html(msg).dialog({
			autoOpen: true,
			modal: false,
			show: 'fade',
			resizable: 'false',				
			buttons: { "<?php echo html_entity_decode($this->translator->translator('common_ok'), ENT_QUOTES, 'UTF-8'); ?>": function() { $(this).dialog('option', 'hide', 'explode').dialog("close"); } },
			open: function(event, ui)
				 {
					setTimeout(function() 
					{									
						if($('#' + event.target.id).dialog('isOpen'))
						{
							$('#' + event.target.id).dialog('option', 'hide', 'explode').dialog('close');										
						}
					}, 10000);
				  }
		});
}

function allFunction()
{			
	$('a.delete_btn').unbind('click');
	$('a.delete_btn').click(function() {
		var self = this;
		$("#dialog-confirm").html("<?php echo addslashes($this->translator->translator('invoice_list_delete_confirm')); ?>").dialog({
			resizable: false,
			width:400,
			height:170,
			modal: true,
			show: 'fade',
			hide: 'explode',
			buttons: {
					'<?php echo html_entity_decode($this->translator->translator("common_delete"), ENT_QUOTES, "UTF-8"); ?>': function() {
					deleteThis(self);
					$(this).dialog('close');
				},
			'<?php echo html_entity_decode($this->translator->translator("common_cancel"), ENT_QUOTES, "UTF-8"); ?>': function() {
					$(this).dialog('close');
				}
			}
		});
		
	});			
}
</script>

<div id="container">
<?php if (!$this->allow('list')) : ?>
	<div class="grid_12 t_a_bottom">
		<?php echo $this->translator->translator('Member_Access_deny_desc'); ?>
	</div>
<?php else : ?>

<div class="title-container">
	<div class="invoice-list"><h1><?php echo $this->translator->translator('invoice_list_page_name'); ?></h1></div>
    
    <div class="button-container">
        <?php if ($this->allow('paid','backend','Invoice')) : ?>
        <span class="button  ui-widget-content-1"><a href="javascript: void(0);" rel="paid" class="publish_all"><span class="icon publish"><?php echo $this->translator->translator('common_paid_selected'); ?></span></a></span>
        <?php endif; ?>
        
		<?php if ($this->allow('paid','backend','Invoice')) : ?>
        <span class="button  ui-widget-content-1"><a href="javascript: void(0);" rel="unpaid" class="publish_all"><span class="icon unpublish"><?php echo $this->translator->translator('common_unpaid_selected'); ?></span></a></span>
        <?php endif; ?>

		<?php if ($this->allow('delete','backend','Invoice')) : ?>
        <span class="button  ui-widget-content-1"><a href="javascript: void(0);" class="delete_all"><span class="icon delete"><?php echo html_entity_decode($this->translator->translator("common_delete_selected"), ENT_QUOTES, "UTF-8"); ?></span></a></span>
        <?php endif; ?>

		<?php if ($this->allow('paid','backend','Invoice')) : ?>
        <span class="button  ui-widget-content-1"><a href="javascript: void(0);" rel="cancel" class="publish_all"><span class="icon close"><?php echo $this->translator->translator('common_cancel_selected'); ?></span></a></span>
        <?php endif; ?>
    </div>
</div>
<div id="button_top_bar"></div>
<div class="content-container">
	<div id="sidebar-inner">
    	<?php echo $this->partial('nav_menu.phtml');  ?>
    </div>
    
    
    <div id="content-inner">
    	<div id="topPagination" class="pagination">
        	<?php echo $this->paginationControl($this->datas, 'Sliding', 'top_pagination.phtml'); ?>
        </div>
        
        <div class="chart">
            <div class="data-table">
            	<table id="sortTable" width="100%" align="center" cellpadding="0" cellspacing="0">
                    <thead>
                    	<tr>
                        	<th width="1%" class="center"><input type="checkbox" name="checkAll" id="checkAll" class="checkAll_btn" /></th>
                            <th width="8%"><?php echo $this->translator->translator('invoice_list_invoice_id'); ?></th>
                          	<th width="16%"><?php echo $this->translator->translator('invoice_list_client_name'); ?> </th>
                          	<th width="11%"><?php echo $this->translator->translator('invoice_list_invoice_date'); ?> </th>
                            <th width="11%"><?php echo $this->translator->translator('invoice_list_invoice_total'); ?> </th>
                          	<th width="14%"><?php echo $this->translator->translator('invoice_list_invoice_now_payable'); ?> </th>
                            <th width="12%"><?php echo $this->translator->translator('invoice_list_invoice_payment'); ?></th>
                          	<th width="5%"><?php echo $this->translator->translator('payment_status'); ?></th>												 
                            <th width="12%"><?php echo $this->translator->translator('common_action'); ?></th>
                      </tr>
                    </thead>
                    <tbody>
						<?php								
                        $j = 1;												
                        foreach ($this->datas as $entry): 
                            $member_info = $mem_db->getMemberInfo($entry->user_id);
                            if($j % 2 == 0)
                            {
                                $onmouseout = "this.bgColor='#FFFFFF';";
                                $background = '#FFFFFF';
                            }
                            else
                            {
                                $onmouseout = "this.bgColor='#F7F7F7';";
                                $background = '#F7F7F7';
                            }
                        ?>
                    	<tr bgcolor="<?php echo $background; ?>" onmouseover="this.bgColor='#FCF5DD';" onmouseout="<?php echo $onmouseout; ?>">
                     		<td class="center checkbox"><input type="checkbox" name="checkbtn" id="checkbtn" value="<?php echo $this->escape($entry->id); ?>" class="check_btn" /></td>
                      		<td class="center"><?php echo $this->escape($entry->id); ?></td>
                      		<td><a href="<?php echo $this->url( array('module'=> 'Invoice', 'controller' => 'backend', 'action'     => 'details', 'invoice_id' => $this->escape($entry->id) ), 'adminrout',    true) ?>"><?php echo $this->escape($member_info['title']).' '.$this->escape($member_info['firstName']).' '.$this->escape($member_info['lastName']); ?></a></td>
                      		<td title="<?php echo $this->escape($entry->invoice_create_date); ?>"><?php echo $this->escape($entry->invoice_create_date); ?></td>
                      		<td><?php echo $currencySymbol.' '.$this->escape($entry->total + $entry->tax + $entry->service_charge).' '.$currencyShort; ?></td>
                      		<td><?php echo $currencySymbol.' '.$this->escape($entry->now_payable).' '.$currencyShort; ?> <?php if(!empty($entry->now_payable)){ ?> (<span><?php if($this->escape($entry->now_payable_paid_status) == '1'){ echo $this->translator->translator('invoice_list_invoice_now_payable_paid_language'); }else { echo $this->translator->translator('invoice_list_invoice_now_payable_unpaid_language'); }  ?></span>)<?php } ?></td>
                      
                       		<td>	
								<?php if($this->escape($entry->status) != '1'){ ?>											   
                                <select name="full_payment" id="full_payment" class="full_payment">
                                    <option value=""><?php echo $this->translator->translator('invoice_list_invoice_now_pay').'.....'; ?></option>
                                    <?php
                                        foreach($gateway_info as $key => $value)
                                        {
                                    ?>
                                    <option value="<?php echo $this->escape($value['id']).'_'.$this->escape($entry->id); ?>"><?php echo $this->escape($value['name']); ?></option>
                                    <?php
                                        }
                                    ?>
                                </select>
								<span></span>
                                <?php } ?>
                       		</td>
                      		<td class="center"><?php if($this->escape($entry->status) == '1'){ echo $this->translator->translator('common_paid_language'); }else if($this->escape($entry->status) == '2'){ echo $this->translator->translator('common_unpaid_language'); }else if($this->escape($entry->status) == '0'){ echo $this->translator->translator('common_cancelled_language'); }  ?></td>
                      		<td class="tools-list">
                            	<ul>
                                    <li>
                                    <?php if ($this->allow('edit','backend','Invoice')) : ?>
                                    <a href="<?php echo $this->url( array('module'=> 'Invoice', 'controller' => 'backend', 'action'     => 'edit', 'id' => $this->escape($entry->id) ), 'adminrout',    true) ?>"><img src="application/modules/Administrator/layouts/scripts/images/tools/edit.png" title="<?php echo $this->translator->translator('common_edit_title'); ?>" alt="<?php echo $this->translator->translator('common_edit_title'); ?>"  border="0" /></a>
                                    <?php endif; ?>
                                    </li>
                                    
                          			<li>
                                	<?php if ($this->allow('details','backend','Invoice')) : ?>
                               		<a href="<?php echo $this->url( array('module'=> 'Invoice', 'controller' => 'backend', 'action'     => 'details', 'invoice_id' => $this->escape($entry->id) ), 'adminrout',    true) ?>"  ><img src="application/modules/Administrator/layouts/scripts/images/tools/view.gif" title="<?php echo $this->translator->translator('invoice_list_invoice_view_details'); ?>" alt="<?php echo $this->translator->translator('invoice_list_invoice_view_details'); ?>" border="0" /></a>
                                	<?php endif; ?>
                                    </li>
                                	
                                    <li>
									<?php if ($this->allow('view','backend','Invoice')) : ?>
                                	<a href="javascript:void(0);" class="invoice_btn" rel="<?php echo $this->escape($entry->id); ?>"><img src="application/modules/Administrator/layouts/scripts/images/tools/preview.gif" border="0" title="<?php echo $this->translator->translator('common_preview_title'); ?>" /></a>
                                	<?php endif; ?>
                                    </li>
                              	</ul>
                          	</td>													
                        </tr>
                    	<?php 													
                        	$j++;
                        	endforeach;	
                      	?>
                   	</tbody>
				</table>
            </div>
      	</div>
        
        <div id="bottomPagination" class="pagination">
        	<?php echo $this->paginationControl($this->datas, 'Sliding', 'pagination.phtml'); ?>
        </div>
	</div>
    
    <div class="button-container">
        <?php if ($this->allow('paid','backend','Invoice')) : ?>
        <span class="button  ui-widget-content-1"><a href="javascript: void(0);" rel="paid" class="publish_all"><span class="icon publish"><?php echo $this->translator->translator('common_paid_selected'); ?></span></a></span>
        <?php endif; ?>
        
		<?php if ($this->allow('paid','backend','Invoice')) : ?>
        <span class="button  ui-widget-content-1"><a href="javascript: void(0);" rel="unpaid" class="publish_all"><span class="icon unpublish"><?php echo $this->translator->translator('common_unpaid_selected'); ?></span></a></span>
        <?php endif; ?>

		<?php if ($this->allow('delete','backend','Invoice')) : ?>
        <span class="button  ui-widget-content-1"><a href="javascript: void(0);" class="delete_all"><span class="icon delete"><?php echo html_entity_decode($this->translator->translator("common_delete_selected"), ENT_QUOTES, "UTF-8"); ?></span></a></span>
        <?php endif; ?>

		<?php if ($this->allow('paid','backend','Invoice')) : ?>
        <span class="button  ui-widget-content-1"><a href="javascript: void(0);" rel="cancel" class="publish_all"><span class="icon close"><?php echo $this->translator->translator('common_cancel_selected'); ?></span></a></span>
        <?php endif; ?>
    </div>
</div>

<div id="floatingbar">

	<h1><?php echo $this->translator->translator('invoice_list_page_name'); ?></h1>
    
    <div class="button-container">
        <?php if ($this->allow('paid','backend','Invoice')) : ?>
        <span class="button  ui-widget-content-1"><a href="javascript: void(0);" rel="paid" class="publish_all"><span class="icon publish"><?php echo $this->translator->translator('common_paid_selected'); ?></span></a></span>
        <?php endif; ?>
        
		<?php if ($this->allow('paid','backend','Invoice')) : ?>
        <span class="button  ui-widget-content-1"><a href="javascript: void(0);" rel="unpaid" class="publish_all"><span class="icon unpublish"><?php echo $this->translator->translator('common_unpaid_selected'); ?></span></a></span>
        <?php endif; ?>

		<?php if ($this->allow('delete','backend','Invoice')) : ?>
        <span class="button  ui-widget-content-1"><a href="javascript: void(0);" class="delete_all"><span class="icon delete"><?php echo html_entity_decode($this->translator->translator("common_delete_selected"), ENT_QUOTES, "UTF-8"); ?></span></a></span>
        <?php endif; ?>

		<?php if ($this->allow('paid','backend','Invoice')) : ?>
        <span class="button  ui-widget-content-1"><a href="javascript: void(0);" rel="cancel" class="publish_all"><span class="icon close"><?php echo $this->translator->translator('common_cancel_selected'); ?></span></a></span>
        <?php endif; ?>
    </div>
</div>
<?php endif; ?>

<div id="dialog_container" title="<?php echo $this->translator->translator('common_dialog_msg',$this->translator->translator('invoice_list_page_name')); ?>"></div>
<div id="dialog-confirm" title="<?php echo $this->translator->translator('common_confirmation',$this->translator->translator('common_delete')); ?>"></div>
</div>